'use strict';
import Toast from "react-native-toast";


export default class SRJudge {
    //有结果返回时处理
    static successful(results, isSuccessJudge) {
        Toast.hide();
        if (isSuccessJudge === 1) {
            Toast.show(results.msg);
        }else if (isSuccessJudge === -1) {
            if (200 != results.code) {
                Toast.show(results.msg);
            }
        }else if (isSuccessJudge === 0) {

        }else {
            Toast.show(isSuccessJudge);
        }
    }

    //没有结果返回时处理
    static failure(err, isSuccessJudge) {
        Toast.hide();
        if (isSuccessJudge === 1) {
            Toast.show('服务器繁忙，请稍后再试;Code:' + err.status);
        } else if (isSuccessJudge !== 0) {
            Toast.show(isSuccessJudge);
        } else {
            Toast.show('服务器繁忙，请稍后再试;Code:' + err.status);
        }
    }
}
